home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 44 / Amiga Format CD44 (1999-08-26)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-10].iso / -serious- / misc / alockutils / alockutils-install < prev    next >
Text File  |  1999-07-26  |  8KB  |  372 lines

  1. ;------------------------------------------------------------------------
  2. ;
  3. ; $VER: ALockUtils-Install 1.0 (31.7.96)
  4. ;
  5. ; Copyright (c) 1996 Janne Peräaho.
  6. ; All Rights Reserved.
  7. ;
  8. ;------------------------------------------------------------------------
  9.  
  10. ;------------------------------------------------------------------------
  11. ; Prompt texts
  12. ;------------------------------------------------------------------------
  13. (set #etc1-text "Select directory for\npasswd, finger.log, and motd files\nDirectory etc will be created")
  14. (set #etc2-text "Copying files to ")
  15. (set #etc3-text "Creating directory etc...")
  16. (set #host-text "\nSet computer name (HostName)")
  17. (set #commands1-text "Select directory for commands")
  18. (set #commands2-text "Copying commands to ")
  19. (set #commands3-text "Login\nCopy icon?")
  20. (set #cmd31-text "No")
  21. (set #cmd32-text "Login_1.info")
  22. (set #cmd33-text "Login_2.info")
  23. (set #commands4-text "Copying icon...")
  24. (set #commands5-text "Passwd\nCopy icon?")
  25. (set #cmd51-text "No")
  26. (set #cmd52-text "Passwd_1.info")
  27. (set #cmd53-text "Passwd_2.info")
  28. (set #homes1-text "Select directory for users homes\nDirectory homes will be created")
  29. (set #homes2-text "Creating directory homes...")
  30. (set #home-text "Creating home for root...")
  31. (set #doc1-text "Select directory for ALockUtils documentation")
  32. (set #doc2-text "Copying documentation...")
  33. (set #ustartup1-text "Insert login procedure to the User-Startup?")
  34. (set #usneg-text "No")
  35. (set #uspos-text "Yes")
  36. (set #ustartup2-text "\nInserting login procedure to the User-Startup...")
  37. (set #info-text "\nATTENTION!\n\nTo log in as a first time the following user profile is created:\n\nLogin ID: root\nPassword: root\nName: System Administrator\n\nREMEMBER TO CHANGE YOUR PASSWORD!")
  38. (set #login-text "\nLog into a system now.")
  39.  
  40. ;------------------------------------------------------------------------
  41. ; Help texts
  42. ;------------------------------------------------------------------------
  43. (set #etc1-help "")
  44. (set #etc2-help "")
  45. (set #etc3-help "")
  46. (set #host-help "")
  47. (set #commands1-help "")
  48. (set #commands2-help "")
  49. (set #commands3-help "")
  50. (set #commands4-help "")
  51. (set #commands5-help "")
  52. (set #homes1-help "")
  53. (set #homes2-help "")
  54. (set #home-help "")
  55. (set #doc1-help "")
  56. (set #doc2-help "")
  57. (set #ustartup1-help "")
  58. (set #ustartup2-help "")
  59. (set #login-help "")
  60.  
  61. ;------------------------------------------------------------------------
  62. ; Install files
  63. ;------------------------------------------------------------------------
  64. ; Check if files installed
  65. (set #alock
  66.     (exists "ETC:passwd"
  67.         (noreq)
  68.     )
  69. )
  70. (if (= #alock 0)
  71.     (
  72.         ; Get etc directory
  73.         (set @default-dest
  74.             (askdir
  75.                 (prompt #etc1-text)
  76.                 (help #etc1-help)
  77.                 (default "Boot:")
  78.             )
  79.         )
  80.         ; Store path
  81.         (set #etc (tackon @default-dest "etc"))
  82.  
  83.         ; Create directory etc
  84.         (makedir #etc
  85.             (prompt #etc3-text)
  86.             (help #etc3-help)
  87.             (confirm)
  88.         )
  89.  
  90.         ; Make assign
  91.         (makeassign "ETC" #etc)
  92.  
  93.         ; Copy files
  94.         (set #copyprompt (cat (cat #etc2-text #etc) "..."))
  95.         (copyfiles
  96.             (prompt #copyprompt)
  97.             (help #etc2-help)
  98.             (source "ETC/")
  99.             (dest #etc)
  100.             (all)
  101.             (files)
  102.             (confirm)
  103.         )
  104.     )
  105. )
  106.  
  107. ;------------------------------------------------------------------------
  108. ; Set HostName
  109. ;------------------------------------------------------------------------
  110. ; Check if host name exists
  111. (set #hostname
  112.     (exists "ENVARC:HostName"
  113.         (noreq)
  114.     )
  115. )
  116. (if (= #hostname 0)
  117.     (
  118.         ; Get hostname
  119.         (set #hostname
  120.             (askstring
  121.                 (prompt #host-text)
  122.                 (help #host-help)
  123.                 (default "AMIGA")
  124.             )
  125.         )
  126.         ; Set hostname
  127.         (textfile
  128.             (prompt "")
  129.             (help "")
  130.             (dest "ENVARC:HostName")
  131.             (append #hostname)
  132.         )
  133.         (textfile
  134.             (prompt "")
  135.             (help "")
  136.             (dest "ENV:HostName")
  137.             (append #hostname)
  138.         )
  139.     )
  140. )
  141.  
  142. ;------------------------------------------------------------------------
  143. ; Install commands
  144. ;------------------------------------------------------------------------
  145. ; Get commands directory
  146. (set @default-dest
  147.     (askdir
  148.         (prompt #commands1-text)
  149.         (help #commands1-help)
  150.         (default "C:")
  151.     )
  152. )
  153.  
  154. ; Store path
  155. (set #commands @default-dest)
  156.  
  157. ; Copy commands
  158. (copyfiles
  159.     (prompt #commands2-text)
  160.     (help #commands2-help)
  161.     (source "C/")
  162.     (dest @default-dest)
  163.     (all)
  164.     (files)
  165. )
  166.  
  167. ; Copy Login icons?
  168. (set #loginicon
  169.     (askchoice
  170.         (prompt #commands3-text)
  171.         (help #commands3-help)
  172.         (choices #cmd31-text #cmd32-text #cmd33-text)
  173.         (default 1)
  174.     )
  175. )
  176. (select #loginicon
  177.     ; Don't copy
  178.     (set #loginicon 0)
  179.     ; Copy 1st icon
  180.     (
  181.         (copyfiles
  182.             (prompt #commands4-text)
  183.             (help #commands4-help)
  184.             (source "Icons/Login_1.info")
  185.             (dest #commands)
  186.             (newname "Login.info")
  187.             (files)
  188.             (infos)
  189.             (noposition)
  190.         )
  191.     )
  192.     ; Copy 2nd icon
  193.     (
  194.         (copyfiles
  195.             (prompt #commands4-text)
  196.             (help #commands4-help)
  197.             (source "Icons/Login_2.info")
  198.             (dest #commands)
  199.             (newname "Login.info")
  200.             (files)
  201.             (infos)
  202.             (noposition)
  203.         )
  204.     )
  205. )
  206.  
  207. ; Copy Passwd icons?
  208. (set #passwdicon
  209.     (askchoice
  210.         (prompt #commands5-text)
  211.         (help #commands5-help)
  212.         (choices #cmd51-text #cmd52-text #cmd53-text)
  213.         (default 1)
  214.     )
  215. )
  216. (select #passwdicon
  217.     ; Don't copy
  218.     (set #passwdicon 0)
  219.     ; Copy 1st icon
  220.     (
  221.         (copyfiles
  222.             (prompt #commands4-text)
  223.             (help #commands4-help)
  224.             (source "Icons/Passwd_1.info")
  225.             (dest #commands)
  226.             (newname "Passwd.info")
  227.             (files)
  228.             (infos)
  229.             (noposition)
  230.         )
  231.     )
  232.     ; Copy 2nd icon
  233.     (
  234.         (copyfiles
  235.             (prompt #commands4-text)
  236.             (help #commands4-help)
  237.             (source "Icons/Passwd_2.info")
  238.             (dest #commands)
  239.             (newname "Passwd.info")
  240.             (files)
  241.             (infos)
  242.             (noposition)
  243.         )
  244.     )
  245. )
  246.  
  247. ;------------------------------------------------------------------------
  248. ; Get homes directory
  249. ;------------------------------------------------------------------------
  250. (set @default-dest
  251.     (askdir
  252.         (prompt #homes1-text)
  253.         (help #homes1-help)
  254.         (default "Boot:")
  255.         (disk)
  256.     )
  257. )
  258. ; Store path
  259. (set #homes @default-dest)
  260.  
  261. ; Store path
  262. (set #homes (tackon @default-dest "homes"))
  263.  
  264. ; Create directory homes
  265. (makedir #homes
  266.     (prompt #homes2-text)
  267.     (help #homes2-help)
  268.     (confirm)
  269. )
  270.  
  271. ; Make assign
  272. (makeassign "HOMES" #homes)
  273.  
  274. ;------------------------------------------------------------------------
  275. ; Perform fake login
  276. ;------------------------------------------------------------------------
  277. (textfile
  278.     (prompt "")
  279.     (help "")
  280.     (dest "ENV:UserName")
  281.     (append "System Administrator")
  282. )
  283. (textfile
  284.     (prompt "")
  285.     (help "")
  286.     (dest "ENV:UserID")
  287.     (append "root")
  288. )
  289.  
  290. ;------------------------------------------------------------------------
  291. ; Create home for root
  292. ;------------------------------------------------------------------------
  293. (set #command (cat "C/HomeAdd PATH=" #homes))
  294. (set #command (cat #command " ID=root STARTUP MOTD"))
  295. (run #command
  296.     (prompt #home-text)
  297.     (help #home-help)
  298. )
  299. (makeassign "HOME" "HOMES:root")
  300.  
  301. ;------------------------------------------------------------------------
  302. ; Copy docs
  303. ;------------------------------------------------------------------------
  304. (set @default-dest
  305.     (askdir
  306.         (prompt #doc1-text)
  307.         (help #doc1-help)
  308.         (default "HELP:")
  309.     )
  310. )
  311.  
  312. (copyfiles
  313.     (prompt #doc2-text)
  314.     (help #doc2-help)
  315.     (source "Docs/")
  316.     (dest @default-dest)
  317.     (all)
  318.     (files)
  319.     (confirm)
  320. )
  321.  
  322. ;------------------------------------------------------------------------
  323. ; Update User-Startup
  324. ;------------------------------------------------------------------------
  325. (set #toustartup
  326.     (askchoice
  327.         (prompt #ustartup1-text)
  328.         (help #ustartup1-help)
  329.         (choices #usneg-text #uspos-text)
  330.         (default 1)
  331.     )
  332. )
  333.  
  334. ; Update
  335. (if (= #toustartup 1)
  336.     (
  337.         (set #command (cat "ASSIGN ETC: " #etc))
  338.         (set #command (cat #command "\nASSIGN HOMES: " #homes))
  339.         (set #command (cat #command "\nPATH "))
  340.         (set #command (cat #command #commands))
  341.         (set #command (cat #command " ADD\nLogin"))
  342.         (startup "ALockUtils"
  343.             (prompt #ustartup2-text)
  344.             (help #ustartup2-help)
  345.             (command #command)
  346.             (confirm)
  347.         )
  348.     )
  349. )
  350.  
  351. ;------------------------------------------------------------------------
  352. ; Information about loging in as a first time
  353. ;------------------------------------------------------------------------
  354. (if (= #alock 0)
  355.     (
  356.         (message #info-text
  357.         (all)
  358.         )
  359.     )
  360. )
  361.  
  362. (set @default-dest #commands)
  363.  
  364. ;------------------------------------------------------------------------
  365. ; Execute Login command
  366. ;------------------------------------------------------------------------
  367. (run "Login"
  368.     (prompt #login-text)
  369.     (help #login-help)
  370.     (confirm)
  371. )
  372.